<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------


/* use think\Route;
Route::rule('hello/[:name]','index/hello');

 */
return [
    
   // 'hello/[:name]'=>'index/hello',
   
//     'blog/:year/:month' => ['blog/archive', ['method' => 'get'], ['year' => '\d{4}', 'month' => '\d{2}']],
//     'blog/:id'          => ['blog/get', ['method' => 'get'], ['id' => '\d+']],
//     'blog/:name'        => ['blog/read', ['method' => 'get'], ['name' => '\w+']],
    
    
    '__pattern__'         => [
        'id'    => '\d+',
    ],
    
    'login/login'   =>'index/login/login',
    
    'user/index'      => 'index/user/index',
    'user/create'     => 'index/user/create',
    'user/add'        => 'index/user/add',
    'user/addR'        => 'index/user/allRelation',
    'user/addBook/:id'        => 'index/user/addBook',
    'user/read/[:id]'        => 'index/user/readR',
    'user/add_list'   => 'index/user/addList',
    'user/update/:id' => 'index/user/update',
    'user/updateR/:id' => 'index/user/updateR',
    'user/delete/:id' => 'index/user/delete',
    'user/deleteR/:id' => 'index/user/deleteR',
    'user/[:id]'        => 'index/user/read',
    
    
    
    
    '[blog]' => [
        ':year/:month' => ['blog/archive', ['method' => 'get'], ['year' => '\d{4}', 'month' => '\d{2}']],
        ':id'          => ['blog/get', ['method' => 'get'], ['id' => '\d+']],
        ':name'        => ['blog/read', ['method' => 'get'], ['name' => '\w+']],
    ],
   
    'hello/[:name]'=>function($name="xiaoli"){
        
       return 'Hello '.$name.'!';
    },
    
    
    '__pattern__' => [
        'name' => '\w+',
    ],
    '[hello]'     => [
        ':id'   => ['index/hello', ['method' => 'get'], ['id' => '\d+']],
        ':name' => ['index/hello', ['method' => 'post']],
    ],

    
];




